PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Exit

An Exit statement is used in a Repeat statement to exit the Repeat statement. When AppleScript executes an Exit statement, it terminates loop execution and resumes execution with the next statement following the Repeat statement. You cannot use Exit statements outside of Repeat statements.

SYNTAX
exit
EXAMPLE

For more information on the following script, see the example in Repeat (forever).

tell application "AppleWorks"
    set numberOfDocuments to (count documents)
    set i to 1
    repeat
        if i > numberOfDocuments then
            exit repeat
        end if
        print document i one copy false -- display Print dialog
        close document i saving ask -- ask before saving modified doc
        set i to i + 1
    end repeat
end tell

© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)